<?php
use common\helpers\Html;
use backend\assets\AppAsset;

/* @var $this yii\web\View */

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
    <!DOCTYPE html>
    <html lang="<?= Yii::$app->language ?>">
    <head>
        <meta charset="<?= Yii::$app->charset ?>">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="renderer" content="webkit">
        <?= Html::csrfMetaTags() ?>
        <title><?= Html::encode(Yii::$app->params['adminTitle']);?></title>
        <?php $this->head() ?>
    </head>
    <body class="hold-transition skin-blue-light sidebar-mini fixed">
    <?php $this->beginBody() ?>
    <div class="wrapper">
        <!-- 头部区域 -->
        <?= $this->render('_header', [
            'manager' => Yii::$app->user->identity,
            'menuCates' => Yii::$app->services->menuCate->getOnAuthList()
        ]); ?>
        <!-- 左侧菜单栏 -->
        <?= $this->render('_left', [
            'manager' => Yii::$app->user->identity
        ]); ?>
        <!-- 主体内容区域 -->
        <?= $this->render('_content'); ?>
        <!-- 底部区域 -->
        <?= $this->render('_footer'); ?>
        <!-- 布局样式设置 -->
        <aside class="control-sidebar control-sidebar-dark">
            <div class="tab-content">
                <!-- Home tab content -->
                <div class="tab-pane" id="control-sidebar-home-tab"></div>
            </div>
        </aside>
        <div hidden>
            <audio id ='hu' src="http://downsc.chinaz.net/Files/DownLoad/sound1/201202/634.mp3" controls></audio>
            <button>ioioo</button>
        </div>
        <!-- 右侧区域 -->
        <div class="control-sidebar-bg"></div>
    </div>

    <?= Html::jsFile('@web/resources/js/contabs.js'); ?>
    <script>
        // 配置
        let config = {
            tag: "<?= Yii::$app->debris->backendConfig('sys_tags') ?? false; ?>",
            isMobile: "<?= Yii::$app->params['isMobile'] ?? false; ?>",
        };
    </script>
    <?php $this->endBody() ?>
    </body>


<!--    <script>-->
<!--        var audio = document.getElementById('hu')-->
<!--        setTimeout(function () {-->
<!--            audio.play()-->
<!--        },5000)-->
<!--    </script>-->
    <script>
        setInterval(audio,30000);//每59秒刷新查询一次
        function audio() {
            //var last_count = 4;
            $.ajax({
                type: "get",
                url: "/api/v1/wxapp/qing",//后台方法
                dataType: "json",
                success: function(res) {
                    // alert(res.data);
                    if(res.data >0){
                       // alert(res.data);
                        var audio = document.getElementById('hu')
                        setTimeout(function () {
                            audio.play()
                        },5000)
                    }
                }
            });
        }
    </script>
    </html>
<?php $this->endPage() ?>